*******************************************************************************************************************************
*******************************************************************************************************************************
* Documentation for Reproduction of
* Pager and Freese 2003 TESS Survey Experiment
* TESS Race Discrimination Meta-Analysis
* Stata version 15
* Data available here: http://www.tessexperiments.org/data/pager112.html
*******************************************************************************************************************************
*******************************************************************************************************************************

* use "Pager_Freese.dta", clear
set more off

*******************************************************************************************************************************
*** Racial groups
*******************************************************************************************************************************

tab race1
gen whiteR = race1
recode whiteR (2=0)
tab race1 whiteR
replace whiteR = 0 if latino != 2
tab whiteR race1
tab whiteR latino

tab race2
gen blackR = race2
recode blackR (2=0)
tab race2 blackR
replace blackR = 0 if latino != 2
tab blackR race2
tab blackR latino

tab latino
tab latino, nol
gen hispnR = latino
recode hispnR (2 8 9=0)
tab latino hispnR

*******************************************************************************************************************************
*** Treatments
*******************************************************************************************************************************

tab pag_ran1
tab pag_ran1, nol
gen blackT = pag_ran1
recode blackT (2/3=0)
gen whiteT = pag_ran1
recode whiteT (1 3=0) (2=1)
gen noraceT = pag_ran1
recode noraceT (1/2=0) (3=1)
tab pag_ran1 blackT
tab pag_ran1 whiteT
tab pag_ran1 noraceT

tab pag_ran2
tab pag_ran2, nol
gen laidoffT = pag_ran2
recode laidoffT (2/3=0)
gen firedT = pag_ran2
recode fired (1 3=0) (2=1)
gen prisonT = pag_ran2
recode prisonT (1/2=0) (3=1)
tab pag_ran2 laidoffT
tab pag_ran2 firedT
tab pag_ran2 prisonT

tab pag_ran3
tab pag_ran3, nol
gen steadyT = pag_ran3
recode steadyT (2=0)
gen unsteadyT = pag_ran3
recode unsteadyT (1=0) (2=1)
tab pag_ran3 steadyT
tab pag_ran3 unsteadyT

*******************************************************************************************************************************
*** Outcome variables
*******************************************************************************************************************************

gen help3 = pag1
recode help3 (3=-1) (2=0) (8 9=.)
tab pag1 help3
tab pag1 help3, mi

sum help3 if whiteR==1
di r(sd)
gen ov_white_std = help3/r(sd) if whiteR==1

sum help3 if blackR==1
di r(sd)
gen ov_black_std = help3/r(sd) if blackR==1

sum help3 if hispnR==1
di r(sd)
gen ov_hispn_std = help3/r(sd) if hispnR==1

*******************************************************************************************************************************
*** Racial manipulation check
*******************************************************************************************************************************

// No racial manipulation check

*******************************************************************************************************************************
*** Main regressions [Unweighted]
*******************************************************************************************************************************

reg ov_white_std blackT noraceT laidoffT firedT steadyT if whiteR==1 & noraceT==0
reg ov_black_std blackT noraceT laidoffT firedT steadyT if blackR==1 & noraceT==0
reg ov_hispn_std blackT noraceT laidoffT firedT steadyT if hispnR==1 & noraceT==0
